package com.tct.smartRE.fwk.impl.service;

import java.util.List;

import com.tct.smartRE.fwk.api.IBusinessObject;
import com.tct.smartRE.fwk.api.IQueryCondition;
import com.tct.smartRE.fwk.api.dao.ICommonDAO;
import com.tct.smartRE.fwk.api.service.ICommonDBService;

public class CommonDBService implements ICommonDBService {

	private final ICommonDAO dao;

	public CommonDBService(ICommonDAO dao) {
		this.dao = dao;
	}
	
	public ICommonDAO getDAO() {
		return this.dao;
	}
	
	public Integer countAll(Class<?> clazz) {
		return getDAO().countAll(clazz);
	}

	public Integer countByCondition(IQueryCondition query) {
		return getDAO().countByCondition(query);
	}

	public void delete(IBusinessObject object) {
		getDAO().delete(object);
	}

	public void delete(Integer id, Class<?> clazz) {
		getDAO().delete(id, clazz);
	}

	public List<IBusinessObject> findAll(Class<?> clazz) {
		return getDAO().findAll(clazz);
	}

	public List<IBusinessObject> findByCondition(IQueryCondition query) {
		return getDAO().findByCondition(query);
	}

	public IBusinessObject load(Integer id, Class<?> clazz) {
		return getDAO().load(id, clazz);
	}

	public Integer save(IBusinessObject object) {
		return getDAO().save(object);
	}

}
